package com.gruppe1.inu.ListAdapters;

import java.util.List;

import com.gruppe1.inu.R;
import com.gruppe1.inu.Model.Group;
import com.gruppe1.inu.R.id;
import com.gruppe1.inu.R.layout;



import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class GroupListAdapter extends ArrayAdapter<Group> {
    private  List<Group> mList;

    public GroupListAdapter(Context context, int textViewResourceId, List<Group> _mList) {
        super(context, textViewResourceId, _mList);
  this.mList = _mList;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
  if (v == null) {
            LayoutInflater vi = (LayoutInflater)this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.contact_list_item, null);
  }
      
  Group group = mList.get(position);
  if (group != null) {
            TextView title = (TextView) v.findViewById(R.id.groupTitle);
      TextView namesView = (TextView) v.findViewById(R.id.groupDetailes);


      if (title != null) {
                title.setText(group.getName());
      }
     
      if(namesView!=null){
		  namesView.setText(group.getNamesList());
		  
		  
	  }
		  
      
  }
  return v;
    }
}
